package com.woniu.config;


import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RabbitConfig {
    @Bean(name = "workMessage_exchange")
    public Exchange getExchange() {
        return ExchangeBuilder.directExchange("workMessage_exchange").durable(true).build();
    }

    @Bean(name = "workMessage_queue")
    public Queue getQueue() {
        return QueueBuilder.durable("workMessage_queue").build();
    }

    @Bean
    public Binding getBinding(@Qualifier("workMessage_queue") Queue queue, @Qualifier("workMessage_exchange") Exchange exchange) {
        return BindingBuilder.bind(queue).to(exchange).with("workMessage.add").noargs();
    }

}
